package com.share.example.stock.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * @author syq
 * @data 2019/6/17
 */
@Getter
public enum StockStatusEnum {
    OTHER("-1", "其他情况"),
    EXIT("0", "已退市"),
    ST("1", "st"),
    PAUSE("2", "暂停"),
    NORMAL("3", "正常"),
    RM_HISTORY("4", "不需要历史的code");

    private String code;

    private String descript;

    StockStatusEnum(String code, String descript) {
        this.code = code;
        this.descript = descript;
    }

    public static StockStatusEnum toEnum(final String code) {
        for (final StockStatusEnum tag : StockStatusEnum.values()) {
            if (tag.code.equals(code)) {
                return tag;
            }
        }
        return null;
    }

    //历史日数据需要拉取的状态
    public static List<String> getDayPullStatus() {
        return Arrays.asList(new String[]{StockStatusEnum.NORMAL.code, StockStatusEnum.PAUSE.code});
    }
}
